package kassiopeia.plugin.crawler.processor.config;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamImplicit;

import java.util.List;

@XStreamAlias("items")
public class Configuration {

    @XStreamImplicit(itemFieldName = "item")
    private List<Item> items;

    public List<Item> getItems() {
        return items;
    }

    public void setItems(List<Item> items) {
        this.items = items;
    }

    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("[");
        for (Item i : items) {
            builder.append("\n\t[");
            builder.append(i.getId()).append(", ").append(i.getName()).append(", ").append(i.getDescription());
            for (String k : i.getKeywords()) {
                builder.append(", ").append(k);
            }
            builder.append("]");
        }
        builder.append("\n]");
        return builder.toString();
    }
}
